# coding:utf-8

import redis
import os


class Config(object):
    """配置信息"""
    SECRET_KEY = "clown"
    # 数据库
    SQLALCHEMY_DATABASE_URI = "mysql://root:990518@127.0.0.1:3306/ihome"
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    SQLALCHEMY_ECHO = True
    # redis
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = "6379"
    REDIS_PASSWORD = "990518"

    # flask-session配置
    SESSION_TYPE = "redis"
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWORD)
    SESSION_USE_SIGNER = True  # 对cookie中的session_id进行隐藏
    PERMANENT_SESSION_LIFTTIME = 604800  # session数据的有效期,单位:秒
    BASE_DIR = os.path.dirname(os.path.abspath(__file__))


class DevelopmentConfig(Config):
    """开发模式配置信息"""
    DEBUG = True


class ProductConfig(Config):
    """生产环境配置信息"""
    pass


config_dict = {
    "develop": DevelopmentConfig,
    "product": ProductConfig
}
